package com.ruoyi.project.order.type.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.order.type.mapper.PreOrderTypeMapper;
import com.ruoyi.project.order.type.domain.PreOrderType;
import com.ruoyi.project.order.type.service.IPreOrderTypeService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 预订方式Service业务层处理
 * 
 * @author yyj
 * @date 2021-05-13
 */
@Service
public class PreOrderTypeServiceImpl implements IPreOrderTypeService 
{
    @Autowired
    private PreOrderTypeMapper preOrderTypeMapper;

    /**
     * 查询预订方式
     * 
     * @param preOrderTypeId 预订方式ID
     * @return 预订方式
     */
    @Override
    public PreOrderType selectPreOrderTypeById(Long preOrderTypeId)
    {
        return preOrderTypeMapper.selectPreOrderTypeById(preOrderTypeId);
    }

    /**
     * 查询预订方式列表
     * 
     * @param preOrderType 预订方式
     * @return 预订方式
     */
    @Override
    public List<PreOrderType> selectPreOrderTypeList(PreOrderType preOrderType)
    {
        return preOrderTypeMapper.selectPreOrderTypeList(preOrderType);
    }

    /**
     * 新增预订方式
     * 
     * @param preOrderType 预订方式
     * @return 结果
     */
    @Override
    public int insertPreOrderType(PreOrderType preOrderType)
    {
        preOrderType.setCreateTime(DateUtils.getNowDate());
        return preOrderTypeMapper.insertPreOrderType(preOrderType);
    }

    /**
     * 修改预订方式
     * 
     * @param preOrderType 预订方式
     * @return 结果
     */
    @Override
    public int updatePreOrderType(PreOrderType preOrderType)
    {
        preOrderType.setUpdateTime(DateUtils.getNowDate());
        return preOrderTypeMapper.updatePreOrderType(preOrderType);
    }

    /**
     * 删除预订方式对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deletePreOrderTypeByIds(String ids)
    {
        return preOrderTypeMapper.deletePreOrderTypeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除预订方式信息
     * 
     * @param preOrderTypeId 预订方式ID
     * @return 结果
     */
    @Override
    public int deletePreOrderTypeById(Long preOrderTypeId)
    {
        return preOrderTypeMapper.deletePreOrderTypeById(preOrderTypeId);
    }
}
